package com.roin.learn.springsecurity.util;

import com.roin.learn.springsecurity.common.exception.IErrorCode;
import com.roin.learn.springsecurity.enums.ResultCode;
import com.roin.learn.springsecurity.model.JsonResult;

/**
 * @Description:
 */
public class ResultTool {
    public static JsonResult success() {
        return new JsonResult(true);
    }

    public static <T> JsonResult<T> success(T data) {
        return new JsonResult(true,null, data);
    }

    public static JsonResult fail() {
        return new JsonResult(false);
    }

    public static JsonResult fail(IErrorCode iErrorCode) {
        return new JsonResult(false, iErrorCode);
    }
    public static JsonResult fail(String errorMsg) {
        JsonResult jsonResult = new JsonResult(false);
        jsonResult.setErrorMsg(errorMsg);
        return jsonResult;
    }
}